package com.ruoyi.sale.urtl;

import java.util.ArrayList;
import java.util.List;

public class AncestorsProcessor {

    public Long[] extractAncestors(String ancestorsStr) {
        String[] parts = ancestorsStr.split(",");
        List<Long> ancestorsList = new ArrayList<>();

        for (String part : parts) {
            Long value = Long.parseLong(part.trim());
            if (!value.equals(0L)) {
                ancestorsList.add(value);
            }
        }

        Long[] ancestorsArray = ancestorsList.toArray(new Long[0]);
        return ancestorsArray;
    }
}